<template>
  <children1 @onParentMsg="onChangeMsgParent" :msg="msg" />
</template>

<script lang="ts">
import { defineComponent } from "vue";
// 导入ref
import { ref } from "vue";

// 导入组件
import Children1 from "@/components/day02/Children1.vue";
export default defineComponent({
  name: "App",
  //
  components: {
    Children1,
  },
  // 组合式API入口
  setup() {
    // 定义参数

    const msg = ref("a message from parent");
    const onChangeMsgParent = (data: any) => {
      console.log(data);
      msg.value = data.msg;
    };

    // 返回值

    return { msg, onChangeMsgParent };
  },
});
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
